package com.example.schoolmanage.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.schoolmanage.domain.Student;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.List;

/**
* @author ayuan
* @description 针对表【STUDENT】的数据库操作Mapper
* @createDate 2023-01-31 14:42:18
* @Entity generator.domain.Student
*/
@Component
public interface StudentMapper extends BaseMapper<Student> {
    Student selectOneByStuId(@Param("stuId")Integer id);

//这个内部使用left join连表查
    Student getStuCousbyStuId(@Param("stuId")Integer id);

//这个内部是用collection分部查寻cou_id
    Student getStubyStuId(@Param("stuId") Integer sId);


    boolean addStudent(Student student);

    //查询所有学生
    List<Student>getallStudent();


    //3.版本mybatisPlua Mapper接收参数类型是Page
    Page<Student> getallbypage(Page page);

    //2.版本mybatisPlus Mapper接收参数类型是Rowbound
    //Page<Student> getallbypage(Rowbound page);


    @Override
            //3版 mybatisplus 自带的分页查找
    <E extends IPage<Student>> E selectPage(E page, Wrapper<Student> queryWrapper);

    //对leftjion增加连表查询,去掉查询条件，以便查出多个列
    Page<Student> getStuCous(Page page);

    Student selectOneByStuName(@Param("stuName") String stuName);


}




